package com.huiquan.icd.dao;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.huiquan.analysis.dao.BaseDao;
import com.huiquan.icd.domain.IcdAgeSexMonthDiease;
import com.huiquan.icd.domain.IcdSeasonWeather;
import com.huiquan.icd.domain.IcdWeatherDisease;
import com.huiquan.section.domain.SectionDnnDisable;
import com.ibatis.sqlmap.client.SqlMapClient;

/**
 * 疾病天气 Dao
 *
 * @author leo
 * @time 2017年4月7日 下午4:07:31
 */
@Repository
public class IcdDiseaseWeatherDao extends BaseDao {
	@Resource(name = "sqlMapClient")
	private SqlMapClient sqlMapClient;

	public static final String space = "ICD_DISEASE_WEATHER.";

	/**
	 * 检索得到列表大小
	 * 
	 * @param params
	 * @param status
	 *            1-season_weather，2-weather_disease，3-age_sex_month_disease
	 * @return
	 */
	public int selectListSize(Map<String, Object> params, int status) {
		String str = null;
		if (status == 1) {
			str = "SELECT_ICD_SEASON_WEATHER_COUNT";
		} else if (status == 2) {
			str = "SELECT_ICD_WEATHER_DISEASE_COUNT";
		} else if (status == 3) {
			str = "SELECT_ICD_AGE_SEX_MONTH_DIEASE_COUNT";
		}

		return (int) this.object(space + str, params, sqlMapClient);
	}

	/**
	 * 检索得到列表
	 * 
	 * @param params
	 * @param status
	 *            1-season_weather，2-weather_disease，3-age_sex_month_disease
	 * @return
	 */
	public List<?> selectList(Map<String, Object> params, int status) {
		String str = null;
		if (status == 1) {
			str = "SELECT_ICD_SEASON_WEATHER_LIST";
		} else if (status == 2) {
			str = "SELECT_ICD_WEATHER_DISEASE_LIST";
		} else if (status == 3) {
			str = "SELECT_ICD_AGE_SEX_MONTH_DIEASE_LIST";
		}
		return this.list(space + str, params, sqlMapClient);
	}

	/**
	 * 检索得到导出用列表
	 * 
	 * @param status
	 * @return
	 */
	public List<?> selectListToExport(int status) {
		String str = null;
		if (status == 1) {
			str = "SELECT_ICD_SEASON_WEATHER_LIST_TO_EXPORT";
		} else if (status == 2) {
			str = "SELECT_ICD_WEATHER_DISEASE_LIST_TO_EXPORT";
		} else if (status == 3) {
			str = "SELECT_ICD_AGE_SEX_MONTH_DIEASE_LIST_TO_EXPORT";
		}
		return this.list(space + str, sqlMapClient);
	}

	/**
	 * 插入一条 季节天气
	 * 
	 * @param entity
	 */
	public void insertIcdSeasonWeather(IcdSeasonWeather entity) {
		this.insert(space + "INSERT_ICD_SEASON_WEATHER", entity, sqlMapClient);
	}

	/**
	 * 批量导入 季节天气
	 * 
	 * @param entity
	 */
	public void batchInsertIcdSeasonWeather(List<IcdSeasonWeather> insertList) {
		this.insert(space + "BATCH_INSERT_ICD_SEASON_WEATHER", insertList, sqlMapClient);
	}
	
	/**
	 * 插入一条 天气疾病
	 * 
	 * @param entity
	 */
	public void insertIcdWeatherDisease(IcdWeatherDisease entity) {
		this.insert(space + "INSERT_ICD_WEATHER_DISEASE", entity, sqlMapClient);
	}
	
	/**
	 * 批量导入 天气疾病
	 * 
	 * @param entity
	 */
	public void batchInsertIcdWeatherDisease(List<IcdWeatherDisease> insertList) {
		this.insert(space + "BATCH_INSERT_ICD_WEATHER_DISEASE", insertList, sqlMapClient);
	}

	/**
	 * 插入一条 年龄性别月份疾病
	 * 
	 * @param entity
	 */
	public void insertIcdAgeSexMonthDieaser(IcdAgeSexMonthDiease entity) {
		this.insert(space + "INSERT_ICD_AGE_SEX_MONTH_DIEASE", entity, sqlMapClient);
	}

	/**
	 * 更新一条 季节天气
	 * 
	 * @param entity
	 */
	public void updateIcdSeasonWeather(IcdSeasonWeather entity) {
		this.insert(space + "UPDATE_ICD_SEASON_WEATHER", entity, sqlMapClient);
	}

	/**
	 * 更新一条 天气疾病
	 * 
	 * @param entity
	 */
	public void updateIcdWeatherDisease(IcdWeatherDisease entity) {
		this.insert(space + "UPDATE_ICD_WEATHER_DISEASE", entity, sqlMapClient);
	}

	/**
	 * 更新一条 年龄性别月份疾病
	 * 
	 * @param entity
	 */
	public void updateIcdAgeSexMonthDieaser(IcdAgeSexMonthDiease entity) {
		this.insert(space + "UPDATE_ICD_AGE_SEX_MONTH_DIEASE", entity, sqlMapClient);
	}

	/**
	 * 根据id检索得到一条 季节天气
	 * 
	 * @param id
	 * @return
	 */
	public IcdSeasonWeather selectIcdSeasonWeatherById(int id) {
		return (IcdSeasonWeather) this.object(space + "SELECT_ICD_SEASON_WEATHER_BY_ID", id, sqlMapClient);
	}

	/**
	 * 根据id检索得到一条 天气疾病
	 * 
	 * @param id
	 * @return
	 */
	public IcdWeatherDisease selectIcdWeatherDiseaseById(int id) {
		return (IcdWeatherDisease) this.object(space + "SELECT_ICD_WEATHER_DISEASE_BY_ID", id, sqlMapClient);
	}

	/**
	 * 根据id检索得到一条 年龄性别月份疾病
	 * 
	 * @param id
	 * @return
	 */
	public IcdAgeSexMonthDiease selectIcdAgeSexMonthDieaseById(int id) {
		return (IcdAgeSexMonthDiease) this.object(space + "SELECT_ICD_AGE_SEX_MONTH_DIEASE_BY_ID", id, sqlMapClient);
	}

	/**
	 * 根据id删除一条 季节天气
	 * 
	 * @param id
	 */
	public void deleteIcdSeasonWeatherById(int id) {
		this.delete(space + "DELETE_ICD_SEASON_WEATHER_BY_ID", id, sqlMapClient);
	}

	/**
	 * 根据id删除一条 天气疾病
	 * 
	 * @param id
	 */
	public void delecteIcdWeatherDiseaseById(int id) {
		this.delete(space + "DELETE_ICD_WEATHER_DISEASE_BY_ID", id, sqlMapClient);
	}

	/**
	 * 根据id删除一条 年龄性别月份疾病
	 * 
	 * @param id
	 */
	public void deleteIcdAgeSexMonthDieaseById(int id) {
		this.delete(space + "DELETE_ICD_AGE_SEX_MONTH_DIEASE_BY_ID", id, sqlMapClient);
	}
	
	/**
	 * 删除全部 季节天气
	 * 
	 * 
	 */
	public void deleteIcdSeasonWeather() {
		this.delete(space + "DELETE_SEASON_WEATHER",sqlMapClient);
	}

	/**
	 * 删除全部 天气疾病
	 * 
	 * 
	 */
	public void delecteIcdWeatherDisease() {
		this.delete(space + "DELETE_ICD_WEATHER_DISEASE",sqlMapClient);
	}

	/**
	 * 删除全部 年龄性别月份疾病
	 * 
	 * 
	 */
	public void deleteIcdAgeSexMonthDiease() {
		this.delete(space + "DELETE_ICD_AGE_SEX_MONTH_DIEASE",sqlMapClient);
	}
}
